//
//  ReferTextCostumCell.m
//  MMLOOK
//
//  Created by dllo on 15/8/27.
//  Copyright (c) 2015年 武俊娥. All rights reserved.
//

#import "ReferTextCostumCell.h"

@implementation ReferTextCostumCell

- (void)dealloc
{
    [_detailLable release];
    [_titlelable release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
       // [self creatLable];
        self.titlelable = [[UILabel alloc] init];
        _titlelable.textColor = [UIColor whiteColor];
        _titlelable.backgroundColor = [UIColor colorWithWhite:0 alpha:0.1];
        _titlelable.clipsToBounds = YES;
        _titlelable.layer.cornerRadius = 15;
        [self.contentView addSubview:_titlelable];
        
        self.detailLable = [[UILabel alloc] init];
        _detailLable.textColor = [UIColor whiteColor];
        _detailLable.backgroundColor = [UIColor colorWithWhite:0 alpha:0.1];
        _detailLable.clipsToBounds = YES;
        _detailLable.layer.cornerRadius = 20;
        [self.contentView addSubview:_detailLable];
        
    }
    return self;
}



-(void)layoutSubviews
{
    [super layoutSubviews];
    self.titlelable.frame =  CGRectMake(20, 200, 280*OffWidth, 50*OffHeight);

    self.titlelable.font = [UIFont systemFontOfSize:20*OffHeight];
    CGFloat hight = [[self class] hightWithtext:_detailLable.text];
    self.detailLable.frame = CGRectMake(10, 260, 300, hight);
    _detailLable.numberOfLines = 0;
}

+(CGFloat)hightWithtext:(NSString *)text
{
    
    CGRect rect = [text boundingRectWithSize:CGSizeMake(300, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20*OffHeight]} context:nil];
    NSLog(@"text");
    return rect.size.height;
}




@end
